package acm.蓝桥22;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.StringTokenizer;


public class F_LRU缓存 {
	static int maxn=200010;
	static Node[] nodes=new Node[maxn];
	static Node head,tail;
	static int n,m;
	
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		n=sc.nextInt();
		m=sc.nextInt();
		init(n);
		for(int i=0;i<m;i++) {
			String op=sc.next();
			int x = sc.nextInt();
			if(op.equals("L")) {
				L(x);
			}else {
				R(x);
			}
		}
		Node cur = head.next;
		while(cur!=tail) {
			System.out.print(cur.v+" ");
			cur=cur.next;
		}
	}
	static void L(int x) {
		nodes[x].pre.next=nodes[x].next;
		nodes[x].next.pre=nodes[x].pre;
		nodes[x].next=head.next;
		nodes[x].pre=head;
		head.next.pre=nodes[x];
		head.next=nodes[x];
	}
	
	static void R(int x) {
		nodes[x].pre.next=nodes[x].next;
		nodes[x].next.pre=nodes[x].pre;
		nodes[x].next=tail;
		nodes[x].pre=tail.pre;
		tail.pre.next=nodes[x];
		tail.pre=nodes[x];
	}
	
	public static void init(int n) {
		head=new Node(-1);
		tail=new Node(-1);
		head.next=tail;
		tail.pre=head;
		for(int i=1;i<=n;i++) {
			Node cur=new Node(tail.pre,tail,i);
			tail.pre.next=cur;
			tail.pre=cur;
			nodes[i]=cur;
		}
	}	
	static class Node{
		Node pre,next;
		int v;
		
		public Node(Node pre, Node next, int v) {
			this.pre = pre;
			this.next = next;
			this.v = v;
		}

		public Node(int v) {
			this.v = v;
		}
	}
	static  class Reader {
	    private PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	    private BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
	    private StringTokenizer tokenizer = new StringTokenizer("");

	    private String innerNextLine() {
	        try {
	            return reader.readLine();
	        } catch (IOException ex) {
	            return null;
	        }
	    }

	    public boolean hasNext() {
	        while (!tokenizer.hasMoreTokens()) {    //内存中没有
	            String nextLine = innerNextLine();
	            if (nextLine == null) {     //且没有下一行
	                return false;
	            }
	            tokenizer = new StringTokenizer(nextLine);  //读入一行
	        }
	        return true;
	    }

	    public String nextLine() {
	        tokenizer = new StringTokenizer("");    //清空内存中的字符
	        return innerNextLine();
	    }

	    public void clear() {
	        tokenizer = new StringTokenizer("");
	    }

	    public String next() {
	        hasNext();
	        return tokenizer.nextToken();
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

	    public double nextDouble() {
	        return Double.parseDouble(next());
	    }

	    //    public BigInteger nextBigInt() {
//	        return new BigInteger(next());
//	    }

	}

}
